import request from "@/utils/request";

//新增走马灯配置
export function addRound(data) {
  return request({
    url: "/round",
    method: "post",
    data
  });
}
//修改走马灯配置
export function editRound(data) {
  return request({
    url: "/round",
    method: "put",
    data
  });
}

//删除走马灯

export function deleteRound(id) {
  return request({
    url: "/round/" + id,
    method: "delete"
  });
}
//查询走马灯列表
export function getRoundList(params) {
  return request({
    url: "/round/page",
    method: "get",
    params
  });
}
//查询走马灯详情
export function getRoundDetail(id) {
  return request({
    url: "/round/" + id,
    method: "get"
  });
}

//走马灯排序
export function updateRoundSort(data) {
  return request({
    url: `/round/sort/${data.pid}/${data.tid}`,
    method: "post"
  });
}

//批量上下架
export function batchUpdateStatus(data) {
  return request({
    url: `/round/update/publishStatus`,
    method: "post",
    data
  });
}
/**
 * 产品榜单列表
 * @param data
 * @returns {AxiosPromise}
 */
export function productRankListApi(data) {
  return request({
    url: "/hot/product/page",
    method: "get",
    params: data
  });
}

/**
 * 新增产品榜单
 * @param data
 * @returns {AxiosPromise}
 */
export function addProductRankApi(data) {
  return request({
    url: "/hot/product",
    method: "post",
    data
  });
}
/**
 * 删除产品榜单
 * @param id
 * @returns {AxiosPromise}
 */
export function deleteProductRankApi(id) {
  return request({
    url: `/hot/product/${id}`,
    method: "delete"
  });
}
/**
 * 修改产品榜单
 * @param data
 * @returns {AxiosPromise}
 */
export function updateProductRankApi(data) {
  return request({
    url: `/hot/product`,
    method: "put",
    data
  });
}

/**
 * 移动榜单顺序
 * @param params
 * @returns {AxiosPromise}
 */
export function moveProductRankApi(params) {
  return request({
    url: `/hot/product/sort/${params.pid}/${params.tid}`,
    method: "post"
  });
}

/**
 * 批量上下架产品榜单
 * @param data
 * @returns {AxiosPromise}
 */
export function upProductRankApi(data) {
  return request({
    url: `/hot/product/update/publishStatus`,
    method: "post",
    data
  });
}

/**
 * 根据榜单配置id获取详细信息
 * @param id
 * @returns {AxiosPromise}
 */
export function detailProductRankApi(id) {
  return request({
    url: `/hot/product/${id}`,
    method: "get"
  });
}

export function productApi(productId) {
  return request({
    url: `/product/${productId}`,
    method: "get"
  });
}

/**
 * 获取全部水军账号列表
 * @param params
 * @returns {*}
 */
export function accountList(params) {
  return request({
    url: `/virtual/account/list`,
    method: "get",
    params
  });
}

/**
 * 新增文章信息
 * @param data
 * @returns {*}
 */
export function addArticleApi(data) {
  return request({
    url: `/article/createQuestion`,
    method: "post",
    data
  });
}

/**
 * 详情
 * @param id
 * @returns {*}
 */
export function DetailArticleApi(id) {
  return request({
    url: `/article/${id}`,
    method: "get"
  });
}
/**
 * 更新
 * @param data
 * @returns {*}
 */
export function verifyArticleApi(data) {
  return request({
    url: `/article/verify`,
    method: "put",
    data
  });
}

//获取详情

export function getArticleDetail(id) {
  return request({
    url: `/article/getQuestionById/${id}`,
    method: "get"
  });
}



//修改帖子

export function editArticle(data) {
  return request({
    url: `/article/updateQuestion`,
    method: "put",
    data
  });
}



//批量 通过 和批量 不通过

export function batchVerify(data) {
  return request({
    url: `/article/comment/verifyBatch`,
    method: "put",
    data
  });
}